import request from '@/utils/requestinit'
export function instantiateResolution(peer, peerWithOrgs, channel, chaincodeName, version, args) {
  let data = {
    "peers": peer,
    "peerWithOrgs": peerWithOrgs,
    "channels": channel,
    "chainCodeName": chaincodeName,
    "chainCodeVersion": version,
    "args": args
  };
  // alert(data);
  return request({
    url: 'chaincode/instantiateResolution',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function upgradeResolution(peer, peerWithOrgs, channel, chaincodeName, version, args, upload) {
  let data = {
    "peers": peer,
    "peerWithOrgs": peerWithOrgs,
    "channels": channel,
    "chainCodeName": chaincodeName,
    "chainCodeVersion": version,
    "args": args,
    "upload": upload
  };
  // alert(JSON.stringify(data));
  return request({
    url: 'chaincode/upgradeResolution',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}
